import store from '@/store'

export const imgerror = {
  inserted: (el, options) => {
    el.onerror = () => {
      el.src = options.value
    }
  }
}
// 自定义指令来实现按钮级别的权限控制
export const allow = {
  inserted: (el, options) => {
    // 获取到用户的按钮级别的权限信息
    const points = store.state.user.userInfo.roles.points
    // 如果没有按钮权限，那么久隐藏该指令的dom对象
    console.log(options.value, 'options.value')
    if (!points.includes(options.value)) {
      el.style.display = 'none'
    }
  }
}

